<div id="todayPanel" class="view">
<?php
    /*
	echo CHtml::ajaxButton(
		'Новая запись', 
	    $this->createUrl('/diary/newRecord'), 
	    array(
	    	'update' => '#newRecDiv',
    		'beforeSend' => 'function(){ 
				$("#todayPanel").addClass("loading"); 
    		}',
    		'complete' => '
    			function()
    			{
    				$("#todayPanel").removeClass("loading");
    				$("#todayPanel").slideUp("fast");
    				$("#newRecDiv").slideDown("fast");
    				$("#buttonNewRecord").unbind(); 
    			}
    		',
	    ),
	    array('id' => 'buttonNewRecord')
	);
	*/
	
	echo CHtml::button('Новая запись', array('id' => 'buttonNewRecord'));
	Yii::app()->clientScript->registerScript('btnAddRec', "
	   	var clickAddRec = function()
	   	{
			jQuery.ajax({
				'beforeSend': function() { 
					$('#todayPanel').addClass('loading'); 
    			},
    			'complete':	function() {
    				$('#todayPanel').removeClass('loading');
    				$('#todayPanel').slideUp('fast');
    				$('#newRecDiv').slideDown('fast');
    			},
    			'url': '/diary/newRecord',
    			'cache': false,
    			'success': function(html) {
    				jQuery('#newRecDiv').html(html)
    			}
    		});
    		
	   		return false;
	   	}
	   	
	   	$('#buttonNewRecord').unbind('click').click(clickAddRec);
	");
	

	/*
	echo CHtml::ajaxButton(
		'Обновить', 
	    $this->createUrl('/diary/today', array('Diary_page' => '1')), 
	    array(
	    	'update' => '#ui-tabs-1',
    		'beforeSend' => 'function(){ 
				tmpDiv = $("#ui-tabs-1").html(); 
    			$("#ui-tabs-1").addClass("loading");
    		}',
    		'complete' => '
    			function()
    			{
    				$("#ui-tabs-1").removeClass("loading");
    			}
    		',
	    ),
	    array('id' => 'buttonReload')
	);
	*/
?>
</div>
<div id="newRecDiv" style="display: none;">
</div>

<?php
    $this->widget('zii.widgets.CListView', array(
        'id' => 'diaryRecs',
		'dataProvider' => $dataProvider,
		'itemView' => '_viewDiary',
        'template' => '{pager}{items}{pager}',
        'cssFile' => false,
        //'scriptFile' => false,
        'pager' => array(
            'cssFile' => $this->createUrl('/css/pager.css'),
        ),
    ));
?>